
import store from "@/store";
import MiniFox from "@/util/minifox";
import appConfig from "@/config/appConfig";


let gotoSSO = (e) => {
  // 跳转前先清空token
  store.commit("setToken", "");
  if (appConfig.localAuth) {
    //next({name:'SignIn', props:{path: to.path}});
  } else {
    let uri = new MiniFox.Uri(location.href);
    let authUri = new MiniFox.Uri(process.env.VUE_APP_BASE_API + appConfig.authUri);
    //组织oauth2参数并跳转
    authUri.addParam(appConfig.oauth2.AUTH_REDIRECT_URI, uri.toString());
    let goto = authUri.toString();
    location.href = goto;
  }
};

export default {
  gotoSSO
}
